using System;
using System.Collections;
using System.Collections.Generic;
using LL.Data.Mapping;


namespace NanoERP.Model
{
    /// <summary>
    /// 订单信息（从表）
    /// </summary>
    [Serializable]
    public sealed class Orderdetail
    {
        #region Private Members

        // Variabili di stato
        private bool _isChanged;

        // Primary Key(s) 
        private long _id;

        // Foreign Keys non mappate come Many-To-One 
        private long? _orderid;

        // Properties 
        private long? _goodsid;
        private int? _storageid;
        private string _goodsno;
        private string _goodsbarcode1;
        private string _goodsname;
        private string _goodsspec;
        private string _unit;
        private string _otherunit;
        private decimal? _num;
        private decimal? _unitprice;
        private decimal? _refprice;
        private decimal? _summoneyref;
        private decimal? _agio;
        private decimal? _agioprice;
        private decimal? _taxrate;
        private decimal? _taxprice;
        private decimal? _taxmoney;
        private decimal? _summoney;
        private decimal? _receivenum;
        private long? _receivemoney;
        private decimal? _norecivenum;
        private int? _tag;
        private string _note;
        private DateTime? _deliverydate;
        private string _unit2;
        private decimal? _num2;
        private string _baseunit;
        private decimal? _basenum;
        private long? _ratio;
        private int? _isstop;
        private int? _islargess;
        private string _exfield1;
        private string _exfield2;
        private string _exfield3;
        private decimal? _exfield4;
        private long? _relbillid;
        private int? _relbilltype;
        private long? _promotionid;
        private decimal? _ratio2;
        private string _calcunit;
        private decimal? _calcnum;
        private decimal? _exnum1;
        private decimal? _exnum2;
        private decimal? _exnum3;
        private decimal? _exnum4;
        private string _exfield5;
        private string _exfield6;
        private string _exfield7;
        private string _exfield8;
        private string _exfield9;
        private string _exfield10;
        private string _goodsstation;
        private string _goodsbarcode2;      
        private int _flag;
        #endregion

        #region Default ( Empty ) Class Constructor

        /// <summary>
        /// default constructor
        /// </summary>
        public Orderdetail()
        {
            _id = 0;
            _orderid = null;
            _goodsid = null;
            _storageid = null;
            _goodsno = null;
            _goodsbarcode1 = null;
            _goodsname = null;
            _goodsspec = null;
            _unit = null;
            _otherunit = null;
            _num = null;
            _unitprice = null;
            _refprice = null;
            _summoneyref = null;
            _agio = 100;
            _agioprice = null;
            _taxrate = null;
            _taxprice = null;
            _taxmoney = null;
            _summoney = null;
            _receivenum = null;
            _receivemoney = null;
            _norecivenum = null;
            _tag = null;
            _note = null;
            _deliverydate = DateTime.Now;
            _unit2 = null;
            _num2 = null;
            _baseunit = null;
            _basenum = null;
            _ratio = null;
            _isstop = null;
            _islargess = 0;
            _exfield1 = null;
            _exfield2 = null;
            _exfield3 = null;
            _exfield4 = null;
            _relbillid = null;
            _relbilltype = null;
            _promotionid = null;
            _ratio2 = null;
            _calcunit = null;
            _calcnum = null;
            _exnum1 = null;
            _exnum2 = null;
            _exnum3 = null;
            _exnum4 = null;
            _exfield5 = null;
            _exfield6 = null;
            _exfield7 = null;
            _exfield8 = null;
            _exfield9 = null;
            _exfield10 = null;
            _goodsstation = null;
            _goodsbarcode2 = null;

            _flag = 0;
        }

        #endregion // End of Default ( Empty ) Class Constructor

        #region Full Constructor

        /// <summary>
        /// full constructor
        /// </summary>
        public Orderdetail(long id, long? orderid, long? goodsid, int? storageid, string goodsno, string goodsbarcode1, string goodsname, string goodsspec, string unit, string otherunit, decimal? num, decimal? unitprice, decimal? refprice, decimal? summoneyref, decimal? agio, decimal? agioprice, decimal? taxrate, decimal? taxprice, decimal? taxmoney, decimal? summoney, decimal? receivenum, long? receivemoney, decimal? norecivenum, int? tag, string note, DateTime? deliverydate, string unit2, decimal? num2, string baseunit, decimal? basenum, long? ratio, int? isstop, int? islargess, string exfield1, string exfield2, string exfield3, decimal? exfield4, long? relbillid, int? relbilltype, long? promotionid, decimal? ratio2, string calcunit, decimal? calcnum, decimal? exnum1, decimal? exnum2, decimal? exnum3, decimal? exnum4, string exfield5, string exfield6, string exfield7, string exfield8, string exfield9, string exfield10, string goodsstation, string goodsbarcode2)
        {
            _id = id;
            _orderid = orderid;
            _goodsid = goodsid;
            _storageid = storageid;
            _goodsno = goodsno;
            _goodsbarcode1 = goodsbarcode1;
            _goodsname = goodsname;
            _goodsspec = goodsspec;
            _unit = unit;
            _otherunit = otherunit;
            _num = num;
            _unitprice = unitprice;
            _refprice = refprice;
            _summoneyref = summoneyref;
            _agio = agio;
            _agioprice = agioprice;
            _taxrate = taxrate;
            _taxprice = taxprice;
            _taxmoney = taxmoney;
            _summoney = summoney;
            _receivenum = receivenum;
            _receivemoney = receivemoney;
            _norecivenum = norecivenum;
            _tag = tag;
            _note = note;
            _deliverydate = deliverydate;
            _unit2 = unit2;
            _num2 = num2;
            _baseunit = baseunit;
            _basenum = basenum;
            _ratio = ratio;
            _isstop = isstop;
            _islargess = islargess;
            _exfield1 = exfield1;
            _exfield2 = exfield2;
            _exfield3 = exfield3;
            _exfield4 = exfield4;
            _relbillid = relbillid;
            _relbilltype = relbilltype;
            _promotionid = promotionid;
            _ratio2 = ratio2;
            _calcunit = calcunit;
            _calcnum = calcnum;
            _exnum1 = exnum1;
            _exnum2 = exnum2;
            _exnum3 = exnum3;
            _exnum4 = exnum4;
            _exfield5 = exfield5;
            _exfield6 = exfield6;
            _exfield7 = exfield7;
            _exfield8 = exfield8;
            _exfield9 = exfield9;
            _exfield10 = exfield10;
            _goodsstation = goodsstation;
            _goodsbarcode2 = goodsbarcode2;
        }

        #endregion // End Full Constructor

        #region Public Properties

        /// <summary>
        /// 主键
        /// </summary>		
        public long Id
        {
            get { return _id; }
            set { _isChanged |= (_id != value); _id = value; }
        }

        /// <summary>
        /// 采购订单编号：orderInfo
        /// </summary>		
        public long? Orderid
        {
            get { return _orderid; }
            set { _isChanged |= (_orderid != value); _orderid = value; }
        }

        /// <summary>
        /// 商品编号 表：GOODSINFO
        /// </summary>		
        public long? Goodsid
        {
            get { return _goodsid; }
            set { _isChanged |= (_goodsid != value); _goodsid = value; }
        }

        /// <summary>
        /// 仓库编号
        /// </summary>		
        public int? Storageid
        {
            get { return _storageid; }
            set { _isChanged |= (_storageid != value); _storageid = value; }
        }

        /// <summary>
        /// 商品编号
        /// </summary>		
        public string Goodsno
        {
            get { return _goodsno; }
            set
            {
                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Goodsno", value, value.ToString());

                _isChanged |= (_goodsno != value); _goodsno = value;
            }
        }

        /// <summary>
        /// 条形码1
        /// </summary>		
        public string Goodsbarcode1
        {
            get { return _goodsbarcode1; }
            set
            {
                if (value != null)
                    if (value.Length > 100)
                        throw new ArgumentOutOfRangeException("Invalid value for Goodsbarcode1", value, value.ToString());

                _isChanged |= (_goodsbarcode1 != value); _goodsbarcode1 = value;
            }
        }

        /// <summary>
        /// 商品名称
        /// </summary>		
        public string Goodsname
        {
            get { return _goodsname; }
            set
            {
                if (value != null)
                    if (value.Length > 300)
                        throw new ArgumentOutOfRangeException("Invalid value for Goodsname", value, value.ToString());

                _isChanged |= (_goodsname != value); _goodsname = value;
            }
        }

        /// <summary>
        /// 商品规格
        /// </summary>		
        public string Goodsspec
        {
            get { return _goodsspec; }
            set
            {
                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Goodsspec", value, value.ToString());

                _isChanged |= (_goodsspec != value); _goodsspec = value;
            }
        }

        /// <summary>
        /// 单位
        /// </summary>		
        public string Unit
        {
            get { return _unit; }
            set
            {
                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Unit", value, value.ToString());

                _isChanged |= (_unit != value); _unit = value;
            }
        }

        /// <summary>
        /// 单位关系（例：数量+单位）
        /// </summary>		
        public string Otherunit
        {
            get { return _otherunit; }
            set
            {
                if (value != null)
                    if (value.Length > 255)
                        throw new ArgumentOutOfRangeException("Invalid value for Otherunit", value, value.ToString());

                _isChanged |= (_otherunit != value); _otherunit = value;
            }
        }

        /// <summary>
        /// 数量
        /// </summary>		
        public decimal? Num
        {
            get { return _num; }
            set { _isChanged |= (_num != value); _num = value; }
        }

        /// <summary>
        /// 采购单价
        /// </summary>		
        public decimal? Unitprice
        {
            get { return _unitprice; }
            set { _isChanged |= (_unitprice != value); _unitprice = value; }
        }

        /// <summary>
        /// 零售价
        /// </summary>		
        public decimal? Refprice
        {
            get { return _refprice; }
            set { _isChanged |= (_refprice != value); _refprice = value; }
        }

        /// <summary>
        /// 零售价合计
        /// </summary>		
        public decimal? Summoneyref
        {
            get
            {
                _summoneyref = _refprice * _num;
                return _summoneyref;
            }
            set { _isChanged |= (_summoneyref != value); _summoneyref = value; }
        }

        /// <summary>
        /// 折扣率
        /// </summary>		
        public decimal? Agio
        {
            get { return _agio; }
            set { _isChanged |= (_agio != value); _agio = value; }
        }

        /// <summary>
        /// 折扣单价
        /// </summary>		
        public decimal? Agioprice
        {
            get { return _agioprice; }
            set { _isChanged |= (_agioprice != value); _agioprice = value; }
        }

        /// <summary>
        /// 税率
        /// </summary>		
        public decimal? Taxrate
        {
            get { return _taxrate; }
            set { _isChanged |= (_taxrate != value); _taxrate = value; }
        }

        /// <summary>
        /// 含税单价
        /// </summary>		
        public decimal? Taxprice
        {
            get { return _taxprice; }
            set { _isChanged |= (_taxprice != value); _taxprice = value; }
        }

        /// <summary>
        /// 税额
        /// </summary>		
        public decimal? Taxmoney
        {
            get { return _taxmoney; }
            set { _isChanged |= (_taxmoney != value); _taxmoney = value; }
        }

        /// <summary>
        /// 小计
        /// </summary>		
        public decimal? Summoney
        {
            get { return _summoney; }
            set { _isChanged |= (_summoney != value); _summoney = value; }
        }

        /// <summary>
        /// 已发货数量
        /// </summary>		
        public decimal? Receivenum
        {
            get { return _receivenum; }
            set { _isChanged |= (_receivenum != value); _receivenum = value; }
        }

        /// <summary>
        /// 已发货金额
        /// </summary>		
        public long? Receivemoney
        {
            get { return _receivemoney; }
            set { _isChanged |= (_receivemoney != value); _receivemoney = value; }
        }

        /// <summary>
        /// 未到货数量
        /// </summary>		
        public decimal? Norecivenum
        {
            get { return _num; }
            set { _isChanged |= (_num != value); _num = value; }
        }

        /// <summary>
        /// 显示顺序
        /// </summary>		
        public int? Tag
        {
            get { return _tag; }
            set { _isChanged |= (_tag != value); _tag = value; }
        }

        /// <summary>
        /// 备注
        /// </summary>		
        public string Note
        {
            get { return _note; }
            set
            {
                if (value != null)
                    if (value.Length > 200)
                        throw new ArgumentOutOfRangeException("Invalid value for Note", value, value.ToString());

                _isChanged |= (_note != value); _note = value;
            }
        }

        /// <summary>
        /// 到货日期
        /// </summary>		
        public DateTime? Deliverydate
        {
            get { return _deliverydate; }
            set { _isChanged |= (_deliverydate != value); _deliverydate = value; }
        }

        /// <summary>
        /// 辅助单位2
        /// </summary>		
        public string Unit2
        {
            get { return _unit2; }
            set
            {
                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Unit2", value, value.ToString());

                _isChanged |= (_unit2 != value); _unit2 = value;
            }
        }

        /// <summary>
        /// 辅助单位数量2
        /// </summary>		
        public decimal? Num2
        {
            get { return _num2; }
            set { _isChanged |= (_num2 != value); _num2 = value; }
        }

        /// <summary>
        /// 基本单位
        /// </summary>		
        public string Baseunit
        {
            get { return _baseunit; }
            set
            {
                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Baseunit", value, value.ToString());

                _isChanged |= (_baseunit != value); _baseunit = value;
            }
        }

        /// <summary>
        /// 基本数量
        /// </summary>		
        public decimal? Basenum
        {
            get { return _basenum; }
            set { _isChanged |= (_basenum != value); _basenum = value; }
        }

        /// <summary>
        /// 换算比率
        /// </summary>		
        public long? Ratio
        {
            get { return _ratio; }
            set { _isChanged |= (_ratio != value); _ratio = value; }
        }

        /// <summary>
        /// 是否停用商品
        /// </summary>		
        public int? Isstop
        {
            get { return _isstop; }
            set { _isChanged |= (_isstop != value); _isstop = value; }
        }

        /// <summary>
        /// 是否赠品  1是 0否
        /// </summary>		
        public int? Islargess
        {
            get { return _islargess; }
            set { _isChanged |= (_islargess != value); _islargess = value; }
        }

        /// <summary>
        /// 扩展属性1
        /// </summary>		
        public string Exfield1
        {
            get { return _exfield1; }
            set
            {
                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Exfield1", value, value.ToString());

                _isChanged |= (_exfield1 != value); _exfield1 = value;
            }
        }

        /// <summary>
        /// 扩展属性2
        /// </summary>		
        public string Exfield2
        {
            get { return _exfield2; }
            set
            {
                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Exfield2", value, value.ToString());

                _isChanged |= (_exfield2 != value); _exfield2 = value;
            }
        }

        /// <summary>
        /// 扩展属性3
        /// </summary>		
        public string Exfield3
        {
            get { return _exfield3; }
            set
            {
                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Exfield3", value, value.ToString());

                _isChanged |= (_exfield3 != value); _exfield3 = value;
            }
        }

        /// <summary>
        /// 扩展属性4
        /// </summary>		
        public decimal? Exfield4
        {
            get { return _exfield4; }
            set { _isChanged |= (_exfield4 != value); _exfield4 = value; }
        }

        /// <summary>
        /// 调用单据ID  
        /// </summary>		
        public long? Relbillid
        {
            get { return _relbillid; }
            set { _isChanged |= (_relbillid != value); _relbillid = value; }
        }

        /// <summary>
        /// 调用单据类型
        /// </summary>		
        public int? Relbilltype
        {
            get { return _relbilltype; }
            set { _isChanged |= (_relbilltype != value); _relbilltype = value; }
        }

        /// <summary>
        /// 销售员ID
        /// </summary>		
        public long? Promotionid
        {
            get { return _promotionid; }
            set { _isChanged |= (_promotionid != value); _promotionid = value; }
        }

        /// <summary>
        /// 转换比率
        /// </summary>		
        public decimal? Ratio2
        {
            get { return _ratio2; }
            set { _isChanged |= (_ratio2 != value); _ratio2 = value; }
        }

        /// <summary>
        /// 计算单位
        /// </summary>		
        public string Calcunit
        {
            get { return _calcunit; }
            set
            {
                if (value != null)
                    if (value.Length > 50)
                        throw new ArgumentOutOfRangeException("Invalid value for Calcunit", value, value.ToString());

                _isChanged |= (_calcunit != value); _calcunit = value;
            }
        }

        /// <summary>
        /// 计算数量
        /// </summary>		
        public decimal? Calcnum
        {
            get { return _calcnum; }
            set { _isChanged |= (_calcnum != value); _calcnum = value; }
        }

        /// <summary>
        /// 扩展数值1
        /// </summary>		
        public decimal? Exnum1
        {
            get { return _exnum1; }
            set { _isChanged |= (_exnum1 != value); _exnum1 = value; }
        }

        /// <summary>
        /// 扩展数值2
        /// </summary>		
        public decimal? Exnum2
        {
            get { return _exnum2; }
            set { _isChanged |= (_exnum2 != value); _exnum2 = value; }
        }

        /// <summary>
        /// 扩展数值3
        /// </summary>		
        public decimal? Exnum3
        {
            get { return _exnum3; }
            set { _isChanged |= (_exnum3 != value); _exnum3 = value; }
        }

        /// <summary>
        /// 扩展数值4
        /// </summary>		
        public decimal? Exnum4
        {
            get { return _exnum4; }
            set { _isChanged |= (_exnum4 != value); _exnum4 = value; }
        }

        /// <summary>
        /// 扩展属性5
        /// </summary>		
        public string Exfield5
        {
            get { return _exfield5; }
            set
            {
                if (value != null)
                    if (value.Length > 100)
                        throw new ArgumentOutOfRangeException("Invalid value for Exfield5", value, value.ToString());

                _isChanged |= (_exfield5 != value); _exfield5 = value;
            }
        }

        /// <summary>
        /// 扩展属性6
        /// </summary>		
        public string Exfield6
        {
            get { return _exfield6; }
            set
            {
                if (value != null)
                    if (value.Length > 100)
                        throw new ArgumentOutOfRangeException("Invalid value for Exfield6", value, value.ToString());

                _isChanged |= (_exfield6 != value); _exfield6 = value;
            }
        }

        /// <summary>
        /// 扩展属性7
        /// </summary>		
        public string Exfield7
        {
            get { return _exfield7; }
            set
            {
                if (value != null)
                    if (value.Length > 100)
                        throw new ArgumentOutOfRangeException("Invalid value for Exfield7", value, value.ToString());

                _isChanged |= (_exfield7 != value); _exfield7 = value;
            }
        }

        /// <summary>
        /// 扩展属性8
        /// </summary>		
        public string Exfield8
        {
            get { return _exfield8; }
            set
            {
                if (value != null)
                    if (value.Length > 100)
                        throw new ArgumentOutOfRangeException("Invalid value for Exfield8", value, value.ToString());

                _isChanged |= (_exfield8 != value); _exfield8 = value;
            }
        }

        /// <summary>
        /// 扩展属性9
        /// </summary>		
        public string Exfield9
        {
            get { return _exfield9; }
            set
            {
                if (value != null)
                    if (value.Length > 100)
                        throw new ArgumentOutOfRangeException("Invalid value for Exfield9", value, value.ToString());

                _isChanged |= (_exfield9 != value); _exfield9 = value;
            }
        }

        /// <summary>
        /// 扩展属性10
        /// </summary>		
        public string Exfield10
        {
            get { return _exfield10; }
            set
            {
                if (value != null)
                    if (value.Length > 100)
                        throw new ArgumentOutOfRangeException("Invalid value for Exfield10", value, value.ToString());

                _isChanged |= (_exfield10 != value); _exfield10 = value;
            }
        }

        /// <summary>
        /// 货位
        /// </summary>		
        public string Goodsstation
        {
            get { return _goodsstation; }
            set
            {
                if (value != null)
                    if (value.Length > 100)
                        throw new ArgumentOutOfRangeException("Invalid value for Goodsstation", value, value.ToString());

                _isChanged |= (_goodsstation != value); _goodsstation = value;
            }
        }

        /// <summary>
        /// 条形码2
        /// </summary>		
        public string Goodsbarcode2
        {
            get { return _goodsbarcode2; }
            set
            {
                if (value != null)
                    if (value.Length > 100)
                        throw new ArgumentOutOfRangeException("Invalid value for Goodsbarcode2", value, value.ToString());

                _isChanged |= (_goodsbarcode2 != value); _goodsbarcode2 = value;
            }
        }

        /// <summary>
        /// 标记 0-正常，1-删除
        /// </summary>
        [IgnoreAttribute()]
        public int Flag
        {
            get { return _flag; }
            set { _isChanged |= (_flag != value); _flag = value; }
        }

        #endregion

    }
}